//logs.js
const util = require('../../utils/util.js')

Page({
  data: {
    
  },
	onLoad: function (options) {
		wx.showShareMenu({
			withShareTicket: true
		})

		/** 判断场景值，1044 为转发场景，包含shareTicket 参数 */
		if (options.scene == 1044) {
			wx.getShareInfo({
				shareTicket: options.shareTicket,
				success: function (res) {
					var encryptedData = res.encryptedData;
					var iv = res.iv;
				}
			})
		}
  },
	testTo: function () {
		wx.navigateTo({
			url: '/pages/form-page/test/test',
		})
	},
	onShareAppMessage: function (res) {
		if (res.from === 'button') {
			// 来自页面内转发按钮
		}
		return {
			title: '在职研究生报考条件测评（同等学力）',
			path: '/pages/test-page/test-page',
			imageUrl: '',
			success: function (res) {
				// 转发成功
				var shareTickets = res.shareTickets;
				if (shareTickets.length == 0) {
					return false;
				}
				wx.getShareInfo({
					shareTicket: shareTickets[0],
					success: function (res) {
						var encryptedData = res.encryptedData;
						var iv = res.iv;
					}
				})
			},
			fail: function (res) {
				// 转发失败
				if (res.errMsg == 'shareAppMessage:fail cancel') {
					console.log('用户取消转发')
				} else {
					console.log('请检查网络配置')
				}
			}

		}
	}
})
